<div class="menu_account">
    <ul>
        <li><span class="tab"><?php echo CHtml::link('Your Account', array("user/index")); ?></span></li>
        <li class="active"><span class="tab"><?php echo CHtml::link('Update Account', array("user/updateAccount")); ?></span></li>
        <li><span class="tab"><?php echo CHtml::link('Order(s) History', array("user/orderHistory")); ?></span></li>
    </ul>
</div>
<style>
    .update-address-form{padding:10px;}
    span.required{ color: red;}
    .update-address-form input[type='text']{
        border: 1px solid #ccc;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12) inset;
        margin-top: 5px;
        padding: 3px 0 3px 3px;
        width: 97%;
        border-radius: 2px;
    }
    .update-address-form input[type='text']:focus{
        border-color: #7dc9e2;
        outline-color: #dceefc;
    }
    .buttonsubmit-updateaddress{
        background-color: #2cb2bc;
        border: 0 none;
        border-radius: 3px;
        color: #fff;
        display: inline-block;
        line-height: 22px;
        padding: 0 15px;
        margin-left: 120px;
        font-weight: bold;
    }
    .buttonsubmit-updateaddress:hover{
        background-color: #47cad4;
        cursor: pointer;
        color: #fff;
        -webkit-transition: all .15s ease-in;
        -moz-transition: all .15s ease-in;
        -ms-transition: all .15s ease-in;
        -o-transition: all .15s ease-in;
        transition: all .15s ease-in;
    }
    .errorMessage{ color: red;}
</style>
<?php
$user = User::model()->findByPk(Yii::app()->user->id);
$address = UserAddress::model()->findByAttributes(array('uid' => Yii::app()->user->id));
?>
<?php
$form = $this->beginWidget('CActiveForm', array(
    'id' => 'form_register',
    'enableAjaxValidation' => false,
    'enableClientValidation' => true,
    'clientOptions' => array(
        'validateOnSubmit' => true,
    ),
        ));
?>
<div class="update-address-form">
    <?php if (Yii::app()->user->hasFlash('updateaddress')): ?>
        <div class="flash-notice">
            <?php echo Yii::app()->user->getFlash('updateaddress') ?>
        </div>
    <?php endif ?>
    <table>
        <tr>
            <td width="120"><?= $form->labelEx($model, 'displayName') ?></td>
            <td width="260"><?= $form->textField($model, 'displayName', array('value' => $user['display_name'])) ?></td>
            <td><?= $form->error($model, 'displayName', array()) ?></td>
        </tr>
        <tr>
            <td><?= $form->labelEx($model, 'phone') ?></td>
            <td><?= $form->textField($model, 'phone', array('value' => $address['phone'])) ?></td>
            <td><?= $form->error($model, 'phone', array()) ?></td>
        </tr>
        <tr>
            <td><?= $form->labelEx($model, 'company') ?></td>
            <td><?= $form->textField($model, 'company', array('value' => $address['company'])) ?></td>
            <td><?= $form->error($model, 'company', array()) ?></td>
        </tr>
        <tr>
            <td><?= $form->labelEx($model, 'street') ?></td>
            <td><?= $form->textField($model, 'street', array('value' => $address['street'])) ?></td>
            <td><?= $form->error($model, 'street', array()) ?></td>
        </tr>
        <tr>
            <td><?= $form->labelEx($model, 'city') ?></td>
            <td><?= $form->textField($model, 'city', array('value' => $address['city'])) ?></td>
            <td><?= $form->error($model, 'city', array()) ?></td>
        </tr>
        <tr>
            <td><?= $form->labelEx($model, 'region') ?></td>
            <td><?= $form->textField($model, 'region', array('value' => $address['region'])) ?></td>
            <td><?= $form->error($model, 'region', array()) ?></td>
        </tr>
        <tr>
            <td><?= $form->labelEx($model, 'zipCode') ?></td>
            <td><?= $form->textField($model, 'zipCode', array('value' => $address['zipCode'])) ?></td>
            <td><?= $form->error($model, 'zipCode', array()) ?></td>
        </tr>                        
    </table>
    <div style="margin-top: 20px; padding-bottom: 50px">
        <input class="buttonsubmit-updateaddress" type="submit" name="submit" value="Update Address">
    </div>
</div>

<?php $this->endWidget(); ?>